import React, { Component } from 'react';

import {
  Switch,
  Route,
  Router,
  Redirect
} from 'react-router-dom'

import history from './history';


import Index from '@/views/index'
import SearchView from '@/views/search'
// import Error from '@/views/error'
// import Detail from '@/views/detail'
// import { Login } from '@/views/login'
// import NotFound from '@/views/not-found'

class App extends Component {
  render() {
    // const isLogin = this.props.isLogin
    return (
      <Router history={history}>
        <Switch>
          {/* <Route path='/' component={Index} /> */}
          {/* <Route path='*' component={NotFound} /> */}
          {/* <Route path='/error' component={Error} /> */}
          {/* <Route path='/detail' component={Detail} /> */}
          <Route path="/index" component={Index} />
          <Route path='/search' render={
            () => (true ? <SearchView /> : <Redirect to='/index' />)
            // () => (isLogin ? <SearchView /> : <Redirect to='/index' />)
          } />
          <Redirect path='/' to={'/index'} />
        </Switch>
      </Router>
    )
  }
}

export default App;
